/******************************************************************************
*@file  : app.c
*@brief : UART Demos 
******************************************************************************/
#include "app.h"

UART_HandleTypeDef  UART1_Handle;
UART_HandleTypeDef  UART2_Handle;

/******************************************************************************
*@brief : Sample code for initialising UART1 
*@param : none
*@return: none
******************************************************************************/
void UART1_Init(void) 
{
    UART1_Handle.Instance        = UART1;    
    UART1_Handle.Init.BaudRate   = 115200; 
    UART1_Handle.Init.WordLength = UART_WORDLENGTH_8B;
    UART1_Handle.Init.StopBits   = UART_STOPBITS_1;
    UART1_Handle.Init.Parity     = UART_PARITY_NONE;
    UART1_Handle.Init.Mode       = UART_MODE_TX_RX;
    UART1_Handle.Init.HwFlowCtl  = UART_HWCONTROL_NONE;
    
    HAL_UART_Init(&UART1_Handle);  
}

/******************************************************************************
*@brief : Sample code for initialising UART2 
*@param : none
*@return: none
******************************************************************************/
void UART2_Init(void) 
{
    UART2_Handle.Instance        = UART2;    
    UART2_Handle.Init.BaudRate   = 115200; 
    UART2_Handle.Init.WordLength = UART_WORDLENGTH_8B;
    UART2_Handle.Init.StopBits   = UART_STOPBITS_1;
    UART2_Handle.Init.Parity     = UART_PARITY_NONE;
    UART2_Handle.Init.Mode       = UART_MODE_TX_RX;
    UART2_Handle.Init.HwFlowCtl  = UART_HWCONTROL_NONE;
    
    HAL_UART_Init(&UART2_Handle);  
}

/******************************************************************************
*@brief : printf logging message every 1000ms on @BSP_UARTx
*@param : none
*@return: none
******************************************************************************/
void APP_Test()
{
	while(1)
    {
        printfS("hello, %d\r\n", HAL_GetTick());
        HAL_Delay(1000);
    }
}
